var _mm = require('util/mm.js');

var _order = {
    // 获取商品清单
    getProductList: function (resolve, reject) {
        _mm.request({
            url: _mm.getServerUrl('/order/get_order_cart_product.do'),
            success: resolve,
            erroer: reject
        })
    },
    // 创建订单并提交
    createOrder: function (orderInfo, resolve, reject) {
        _mm.request({
            url: _mm.getServerUrl('/order/create.do'),
            data: orderInfo,
            success: resolve,
            erroer: reject
        })
    },
    //获取订单列表
    getOrderList: function (listParam, resolve, reject){
        _mm.request({
            url: _mm.getServerUrl('/order/list.do'),
            data: listParam,
            success: resolve,
            erroer: reject
        })
    },
    // 查看订单详情
    getOrderDetail : function(orderNumber, resolve, reject){
        _mm.request({
            url: _mm.getServerUrl('/order/detail.do'),
            data: {
                orderNo:orderNumber
            },
            success: resolve,
            erroer: reject
        })

    },
    // 取消订单
    cancelOrder : function(orderNumber,resolve,reject){
        _mm.request({
            url: _mm.getServerUrl('/order/cancel.do'),
            data: {
                orderNo:orderNumber
            },
            success: resolve,
            erroer: reject
        })
    }

}

module.exports = _order;